home *** CD-ROM | disk | FTP | other *** search
- onClipEvent(enterFrame){
- function rotate(rvar)
- {
- _rotation = _rotation + 3 * rvar;
- if(_rotation < 0)
- {
- myRotation = 360 + _rotation;
- }
- else
- {
- myRotation = _rotation;
- }
- }
- function constant()
- {
- myXMomentum += myXMovement - myXGravity;
- myYMomentum += myYMovement - myYGravity;
- if(this._x + myXMomentum >= 480 || 120 >= this._x + myXMomentum)
- {
- _parent.foreground._x -= myXMomentum;
- Xparticleshift = myXMomentum;
- }
- else
- {
- this._x += myXMomentum;
- Xparticleshift = 0;
- }
- if(this._y + myYMomentum >= 280 || 120 >= this._y + myYMomentum)
- {
- _parent.foreground._y -= myYMomentum;
- Yparticleshift = myYMomentum;
- }
- else
- {
- this._y += myYMomentum;
- Yparticleshift = 0;
- }
- }
- function arrowcolour()
- {
- myDistance = Math.sqrt(Math.pow(_this._x - _parent.foreground._x,2) + Math.pow(_this._y - _parent.foreground._y,2));
- }
- function explode()
- {
- if(60 >= i)
- {
- duplicateMovieClip(_parent.particle,"mcc" + i,16384 + i);
- _parent["mcc" + i].myGocommand = "blow";
- i++;
- blowdelay++;
- if(i >= 20)
- {
- this.gotoAndStop(2);
- }
- }
- }
- function engineburn()
- {
- if(myPartAmount >= i)
- {
- duplicateMovieClip(_parent.particle,"mc" + i,16384 + i);
- _parent["mc" + i].myGocommand = "go";
- _parent["mc" + i]._x = _X;
- _parent["mc" + i]._y = _Y;
- i++;
- }
- else
- {
- i = 0;
- }
- }
- function gravity()
- {
- origin_x = _root.foreground._x;
- origin_y = _root.foreground._y;
- mouse_x = this._x;
- mouse_y = this._y;
- dist_x = mouse_x - origin_x;
- dist_y = mouse_y - origin_y;
- if(Number(dist_x) < 0)
- {
- normalise = -1 * dist_x;
- }
- else
- {
- normalise = dist_x;
- }
- if(Number(dist_y) < 0)
- {
- normalise = Number(normalise) + Number(-1 * dist_y);
- }
- else
- {
- normalise = Number(normalise) + Number(dist_y);
- }
- if(Number(dist_x) >= 0 and Number(dist_y) >= 0)
- {
- direction = 90 * (dist_y / normalise);
- }
- else if(0 >= Number(dist_x) and Number(dist_y) >= 0)
- {
- direction = Number(-90 * (dist_x / normalise)) + 90;
- }
- else if(0 >= Number(dist_x) and 0 >= Number(dist_y))
- {
- direction = Number(-90 * (dist_y / normalise)) + 180;
- }
- else
- {
- direction = Number(90 * (dist_x / normalise)) + 270;
- }
- myYGravity = Math.sin(0.017453292519943295 * direction) * myGrav;
- myXGravity = Math.cos(0.017453292519943295 * direction) * myGrav;
- _parent.planetfinder._rotation = direction;
- }
- if(WinLose == "lose")
- {
- if(myFailTime)
- {
- if(getTimer() - myFailtime >= 5000)
- {
- myLanded = "stop";
- _parent.popup.gotoAndStop("loser");
- }
- }
- else
- {
- myFailtime = getTimer();
- _root.Angry.go = "stop";
- }
- }
- else if(WinLose == "win")
- {
- if(myWinTime)
- {
- if(getTimer() - myWinTime >= 2000)
- {
- myLanded = "stop";
- _parent.popup.gotoAndStop("winner");
- }
- }
- else
- {
- myWinTime = getTimer();
- _root.Angry.go = "stop";
- }
- }
- if(exploding == "true")
- {
- explode();
- gravity();
- constant();
- myXMovement = 0;
- myYMovement = 0;
- WinLose = "lose";
- }
- if(myLanded == "go")
- {
- gravity();
- constant();
- if(key.isDown(38))
- {
- myVelocity = 0.2;
- engineburn();
- myXMovement = Math.cos(0.017453292519943295 * myRotation) * myVelocity;
- myYMovement = Math.sin(0.017453292519943295 * myRotation) * myVelocity;
- }
- else
- {
- myXmovement = 0;
- myYmovement = 0;
- }
- if(key.isDown(37))
- {
- rotate(-1);
- }
- if(key.isDown(39))
- {
- rotate(1);
- }
- }
- else if(myLanded == "stop")
- {
- myXmovement = 0;
- myYmovement = 0;
- myXMomentum = 0;
- myYMomentum = 0;
- }
- }
-